import { MAX_NAME_LENGTH } from '@/common';

export const limitTextLength = (text: string, maxLength = MAX_NAME_LENGTH) => {
  // 普通显示
  return typeof text === 'string' ? text.slice(0, maxLength) : text;
  // if (typeof text !== 'string') return '';
  // const encoder = new TextEncoder();
  // const encoded = encoder.encode(text);
  // return new TextDecoder().decode(encoded.slice(0, maxLength * 2));
};
